<?php global $ubi;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>TÙM LUM site</title>
        
		<link rel="stylesheet" type="text/css" href="include/css/style.css" media="screen" />
		<link rel="stylesheet" id="contact-form-7-css" href="include/css/styles.css" type="text/css" media="all" />
        <link rel="stylesheet" type="text/css" href="include/css/site.css" media="screen" />
		<link href="include/css/jquery-ui.css" type="text/css" rel="stylesheet" />
		
		<script language="javascript" src="include/script/jquery-1.4.4.min.js" type="text/javascript"></script>
		<script language="javascript" src="include/script/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript" src="include/script/script.js"></script>
				
		<script type="text/javascript" language="javascript">
			$(document).ready(function(){
				$('#randomItemProvider').load('index.php?load&view=randomItemProvider');
				$('#blockSignIn').load('index.php?load&view=blockSignIn');
				$('#blockSearch').load('index.php?load&view=blockSearch');
				$('#blockMembers').load('index.php?load&view=blockMembers');
				$('#blockNewestPosts').load('index.php?load&view=blockNewestPosts');
				$('#mainMenu').load('index.php?load&view=menu');
				$('#footer').load('index.php?load&view=footer');

				var url = 'index.php?location&action=get';
				var pid = 0;			
				$.post(url, 
					{parentID: pid}, 
					function(xml) {			
						var str1 = $.getXMLStringOf(xml, 'location', '<?php echo $address->getCity()?>');
						if (str1 != '') {
							$('select[name=selCity]').html(str1);
						}
					}
				);
				
				$('#datepicker').datepicker(
					{dateFormat:'dd/mm/yy', 
					 changeMonth: true,	
					 changeYear: true,
					 defaultDate: '-25y',
					 yearRange: '1930:2010'});


				$('a#updatePersonalInfo').click(function() {
					if ($('#updatePersonal').is(':visible')) {
						$('#updatePersonal').hide();
					} else {
						$('#updatePersonal').show();
					}
				});

				$('a#updateContactInfo').click(function() {
					if ($('#updateContact').is(':visible')) {
						$('#updateContact').hide();
					} else {
						$('#updateContact').show();
					}
				});

				$('a#updateAddressInfo').click(function() {
					if ($('#updateAddress').is(':visible')) {
						$('#updateAddress').hide();
					} else {
						$('#updateAddress').show();
					}
				});

				$('a#updateEmailInfo').click(function() {
					if ($('#updateEmail').is(':visible')) {
						$('#updateEmail').hide();
					} else {
						$('#updateEmail').show();
					}
				});

				$('a#updatePassInfo').click(function() {
					if ($('#updatePassword').is(':visible')) {
						$('#updatePassword').hide();
					} else {
						$('#updatePassword').show();
					}
				});

				$('a#updateMariageStatusInfo').click(function() {
					if ($('#updateMariageStatus').is(':visible')) {
						$('#updateMariageStatus').hide();
					} else {
						$('#updateMariageStatus').show();
					}
				});

				$('a#updatePrivacyInfo').click(function() {
					if ($('#updatePrivacy').is(':visible')) {
						$('#updatePrivacy').hide();
					} else {
						$('#updatePrivacy').show();
					}
				});

				$('#updatePersonal').hide();
				$('#updateContact').hide();
				$('#updateAddress').hide();
				$('#updateEmail').hide();
				$('#updatePassword').hide();
				$('#updateMariageStatus').hide();
				$('#updatePrivacy').hide();

				$('form[name=frmEmail]').submit(function() {
					var email = $(this).find('[name=txtEmail]').val();
					var reemail = $(this).find('[name=txtReEmail]').val();
					if (email != reemail) {
						alert('Email và xác nhận email chưa chính xác');
						return false;
					} 

					return true;
				});

				$('form[name=frmPassword]').submit(function() {
					var newPass = $(this).find('[name=txtNewPass]').val();
					var reNewPass = $(this).find('[name=txtReNewPass]').val();
					if (newPass == '') {
						alert('Bạn chưa nhập mật khẩu');
						return false;
					}
					if (newPass != reNewPass) {
						alert('Mật khẩu và xác nhận mật khẩu chưa chính xác');
						return false;
					}

					return true;
				});
			});
			
			
		</script>
	</head>
    
    <body id="cookoffboard" class="home blog">
		<div id="corners">			
			<div class="header" id="main-head">
				<div id="hdr-info">
                	<div style="float:left">
                        <img id="logo" src="include/imgs/logo.png" alt="The Cook-Off Board" width="235px" />
                        <p id="desc">Tùm Lum, Tả Pí Lù, chia sẻ tất cả ở đây</p>
                    </div>
                    <div class="nav">
                        <div id="mainMenu"></div>
                        <div style="clear:both"></div>
                    </div>
				</div>              
			</div> <!--end header-->
            
			<div class="polaroids">
            	<div class="marginBoxPicCollection" id="randomItemProvider"></div>
			</div> <!--end polaris-->
            
            <div id="container">
				<hr />
                <div class="left">
                    <div class="section" id="content">
                        <h1>Cập nhật thông tin thành viên</h1>
						<div class="post clearfix">
							<h3>
								<div class="left">Thông tin cá nhân</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updatePersonalInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clearfix"></div>								
							</h3>
							<ul class="info">
								<li>
									<label class="col1">Họ tên</label>
									<label class="col2"><?php echo $user->getLastName()?></label>
								</li>
								<li>
									<label class="col1">Tên</label>
									<label class="col2"><?php echo $user->getFirstName()?></label>
								</li>
								<li>
									<label class="col1">Giới Tính</label>
									<label class="col2">
										<?php 
											if ($user->getGender() == 0) {
												echo "Nữ";
											} else {
												echo "Nam";
											}
										?>
									</label>
								</li>
								<li>
									<label class="col1">Ngày sinh</label>
									<label class="col2">
										<?php echo date($ubi['SERVER']['DATE_FORMAT'],GeneralFunctions::formatDate($user->getDateOfBirth()))?>
									</label>
								</li>
								<li>
									<label class="col1">Nghề nghiệp</label>
									<label class="col2">
									<?php
										$occupation = $occupationList[$user->getOccupationID()];
										echo $occupation->getOccupationName();																			 
									?>
									</label>
								</li>
							</ul>
						</div>
						
						<div class="post clearfix" id="updatePersonal">
							<form action="index.php?profile&type=personal" method="post" name="frmPersonal" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Họ tên <span class="red">*</span></label>
	                                    <input type="text" name="txtLastName" value="<?php echo $user->getLastName()?>" />
	                                </li>
	                                <li>	
				                    	<label>Tên <span class="red">*</span></label>
				                        <input type="text" name="txtFirstName" value="<?php echo $user->getFirstName()?>" />
				                    </li>
	                                <li>
	                                    <label>Giới Tính</label>
	                                    <select name="selGender">
	                                    	<?php
	                                    		if ($user->getGender() == 0) {
	                                    	?>
		                                    		<option value="1">Nam</option>
		                                        	<option value="0" selected="selected">Nữ</option>	
	                                    	<?php 
	                                    		} else {
	                                    	?>
													<option value="1" selected="selected" >Nam</option>
	                                        		<option value="0">Nữ</option>	                                    	
	                                    	<?php 
	                                    		} 
	                                    	?>
	                                    </select>
	                                </li>   
	                                <li>
	                                    <label>Ngày Sinh <span class="red">*</span></label>
	                                    <input id="datepicker" type="text" name="txtDOB" value="<?php echo date($ubi['SERVER']['DATE_FORMAT'],GeneralFunctions::formatDate($user->getDateOfBirth())) ?>" />
	                                </li>                    
	                                <li>
	                                    <label>Nghề Nghiệp</label>
	                                    <select name="selOccupation">	                        
				                        	<?php	                        		
				                        		foreach ($occupationList as $occupationModel) {
				                        		    $id = $occupationModel->getOccupationID();
				                        			$name = $occupationModel->getOccupationName();
				                        			if ($user->getOccupationID() == $id) {
				                        				echo "<option value='$id' selected='selected'>$name</option>";
				                        			} else {
				                        				echo "<option value='$id'>$name</option>";
				                        			}
				                        		}
				                        	?>
				                        </select>
	                                </li>
	                                <li>
	                                	<label>&nbsp;</label>
	                                	<input type="submit" value="Cập Nhật"/>
	                                </li>  
	                            </ul>
							</form>
						</div>
						
						<div class="post clearfix">
							<h3>
								<div class="left">Tình cảm</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updateMariageStatusInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clearfix"></div>								
							</h3>
							<ul>						
								<li>
									<label class="col1">Trạng thái</label>
									<label class="col2">
									<?php
										if ($user->getMariageStatus()) {
											echo $user->getMariageStatus();
										} 
										if ($user->getCoupleUserName()) {
									?>
											<a href="index.php?view&type=user&username=<?php echo $user->getCoupleUserName()?>"><?php echo $user->getCoupleNickName()?></a>
									<?php 
										}
									?>										
									</label>
								</li>
							</ul>
						</div>
				
						<div class="post clearfix" id="updateMariageStatus">
							<form action="index.php?profile&type=mariageStatus" method="post" name="frmMariageStatus" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Trạng thái</label>
	                                    <input type="text" name="txtMariageStatus" value="<?php echo $user->getMariageStatus()?>" />
	                                </li>
	                                <li>
	                                	<label>với</label>
	                                	<input type="text" name="txtCoupleUserName" value="<?php echo $user->getCoupleUserName()?>" />
	                                </li>
	                                <li>
	                                	<label>Tên thân mật</label>
	                                	<input type="text" name="txtCoupleNickName" value="<?php echo $user->getCoupleNickName()?>" />
	                                </li>
	                                <li>
	                                	<label>Tin nhắn</label>
	                                	<textarea rows="5" cols="20" name="txtMessage"></textarea>
	                                </li>
	                                <li>
	                                	<label>&nbsp;</label>
	                                	<input type="submit" value="Cập Nhật"/>
	                                </li>  
	                            </ul>    
						    </form>
						</div>
						                     
						<div class="post clearfix">
							<h3>
								<div class="left">Thông tin liên hệ</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updateContactInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clearfix"></div>
							</h3>
							<ul class="info">
								<li>
									<label class="col1">Điện thoại</label>
									<label class="col2"><?php echo $user->getTelephone()?></label>
								</li>
								<li>
									<label class="col1">Di động</label>
									<label class="col2"><?php echo $user->getCellphone()?></label>
								</li>
							</ul>		
						</div>   
						
						<div class="post clearfix" id="updateContact">
							<form action="index.php?profile&type=contact" method="post" name="frmContact" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Điện thoại</label>
	                                    <input type="text" name="txtTelephone" value="<?php echo $user->getTelephone()?>" />
	                                </li>
	                                <li>
	                                    <label>Di động</label>
	                                    <input type="text" name="txtCellphone" value="<?php echo $user->getCellphone()?>" />
	                                </li>
	                                <li>
	                                	<label>&nbsp;</label>
	                                	<input type="submit" value="Cập Nhật" /> 
	                                </li>
	                        	</ul>
	                        </form>
						</div>						
						
						<div class="post clearfix">
							<h3>
								<div class="left">Địa chỉ</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updateAddressInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clear"></div>
							</h3>
							<ul class="info">
								<li>
									<label class="col1">Số nhà</label>
									<label class="col2"><?php echo $address->getNumber()?></label>
								</li>
								<li>
									<label class="col1">Đường</label>
									<label class="col2"><?php echo $address->getStreet()?></label>
								</li>
								<li>
									<label class="col1">Phường</label>
									<label class="col2"><?php echo $address->getWard()?></label>
								</li>
								<li>
									<label class="col1">Quận</label>
									<label class="col2"><?php echo $address->getDistrict()?></label>
								</li>
								<li>
									<label class="col1">Tỉnh/Thành</label>
									<label class="col2"><?php echo $address->getCity()?></label>
								</li>
							</ul>
						</div>
						
						<div class="post clearfix" id="updateAddress">
							<form action="index.php?profile&type=address" method="post" name="frmAddress" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Số nhà</label>
	                                    <input type="text" name="txtNumber" value="<?php echo $address->getNumber()?>" />
	                                </li>
	                                <li>
	                                    <label>Đường</label>
	                                    <input type="text" name="txtStreet" value="<?php echo $address->getStreet()?>" />
	                                </li>
	                                <li>
	                                    <label>Phường</label>
	                                    <input type="text" name="txtWard" value="<?php echo $address->getWard()?>" />
	                                </li>
	                                <li>
	                                    <label>Quận</label>
	                                    <input type="text" name="txtDistrict" value="<?php echo $address->getDistrict()?>" />
	                                </li>
	                                <li>
	                                    <label>Tỉnh/Thành</label>
	                                    <select name="selCity"></select>
	                                </li>
	                                <li>
	                                	<label>&nbsp;</label>
	                                	<input type="submit" value="Cập Nhật" /> 
	                                </li>
	                        	</ul>
	                        </form>
						</div>
						
						<div class="post clearfix">
							<h3>
								<div class="left">Email</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updateEmailInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clearfix"></div>
							</h3>
							<ul class="info">
								<li>
									<label class="col1">Email</label>
									<label class="col2"><?php echo $user->getEmail()?></label>
								</li>								
							</ul>
						</div>	     
						
						<div class="post clearfix" id="updateEmail">
							<form action="index.php?profile&type=email" method="post" name="frmEmail" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Email</label>
	                                    <input type="text" name="txtEmail" value="<?php echo $user->getEmail()?>" />
	                                </li>
	                                <li>
	                                    <label>Xác nhận email</label>
	                                    <input type="text" name="txtReEmail" />
	                                </li>
	                                <li>
	                                	<label>&nbsp;</label>
	                                	<input type="submit" value="Cập Nhật" /> 
	                                </li>
	                        	</ul>
	                        </form>
						</div>
						
						<div class="post clearfix">
							<h3>
								<div class="left">Mật khẩu</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updatePassInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clear"></div>
							</h3>
						</div>	 						                     
						
						<div class="post clearfix" id="updatePassword">
							<form action="index.php?profile&type=password" method="post" name="frmPassword" class="frmUpdate">
								<ul class="frm">
	                                <li>
	                                    <label>Mật khẩu cũ</label>
	                                    <input type="password" name="txtExPass" />
	                                </li>
	                                <li>
	                                    <label>Mật khẩu mới</label>
	                                    <input type="password" name="txtNewPass" />
	                                </li>
	                                <li>
	                                    <label>Xác nhận mật khẩu mới</label>
	                                    <input type="password" name="txtReNewPass" />
	                                </li>
	                                <li>
	                                	<input type="submit" value="Cập Nhật" /> 
	                                </li>
	                        	</ul>
	                        </form>
						</div>  
						
						<div class="post clearfix">
							<h3>
								<div class="left">Quyền riêng tư</div>
								<div class="right" style="text-align:right">								
									<a class="a_cursor" id="updatePrivacyInfo">
										<img src="include/images/icons/edit-icon.png" width="16px" />
									</a>
								</div>
								<div class="clear"></div>
							</h3>
						</div>    
						
						<div class="post clearfix" id="updatePrivacy">
							<form action="index.php?profile&type=privacy" method="post" name="frmPrivacy" class="frmUpdate">
								<ul class="frmPrivacy">
	                                <li>
	                                    <label>Gửi email khi có thành viên comment trên post của tôi</label>
	                                    <input type="checkbox" name="chkCommnetOnMyPost" <?php echo $isCommentOnMyPost?> value="commentOnMyPost" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên viết lên tường nhà tôi</label>
	                                    <input type="checkbox" name="chkWriteOnMyWall" <?php echo $isWriteOnMyWall?> value="writeOnMyWall" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên cộng điểm cho comment của tôi</label>
	                                    <input type="checkbox" name="chkPlusOnMyComment" <?php echo $isPlusOnMyComment?> value="plusOnMyComment" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên trừ điểm comment của tôi</label>
	                                    <input type="checkbox" name="chkMinusOnMyComment" <?php echo $isMinusOnMyComment?> value="minusOnMyComment" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên cộng điểm cho bài đăng của tôi</label>
	                                    <input type="checkbox" name="chkPlusOnMyPost" <?php echo $isPlusOnMyPost?> value="plusOnMyPost" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên trừ điểm bài đăng của tôi</label>
	                                    <input type="checkbox" name="chkMinusOnMyPost" <?php echo $isMinusOnMyPost?> value="minusOnMyPost" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên yêu thích cho bài đăng của tôi</label>
	                                    <input type="checkbox" name="chkFavOnMyPost" <?php echo $isFavOnMyPost?> value="favOnMyPost" />
	                                </li>
	                                <li>
	                                    <label>Gửi email khi có thành viên gỡ bỏ yêu thích bài đăng của tôi</label>
	                                    <input type="checkbox" name="chkRemoveFavOnMyPost" <?php echo $isUnFavOnMyPost?> value="unFavOnMyPost" />
	                                </li>
	                                <li>
	                                	<input type="submit" value="Cập Nhật" /> 
	                                </li>
	                        	</ul>
	                        </form>
						</div>  
                    </div>  <!--end section -->
            	</div> <!-- end left -->        
                <div class="right">
        			<div class="aside">
                        <ul class="blockRightSide">	
                            <li class="blockRight" id="blockSignIn"></li>
                            <li class="blockRight" id="blockSearch"></li>                                            
                            <li class="blockRight" id="blockMembers"></li>
                            <li class="blockRight" id="blockNewestPosts"></li>
                        </ul>
                    </div>        
                </div> <!--end right-->
			</div> <!--end container-->		
            
            <div id="footer" class="footer clearfix"></div>             
		</div>
	</body>
</html>